package com.example.demo.bizhan.reflect;

import org.apache.commons.beanutils.BeanUtils;
import org.junit.Test;

import java.util.HashMap;
import java.util.Map;

import static java.lang.System.out;

/**
 * @description: xxx
 * @time: 2020/10/27 12:23
 * @author: baojinlong
 **/
public class BeanUtilsDemoTest {
    @Test
    public void test01() throws Exception {
        Student student = new Student();
        BeanUtils.setProperty(student, "name", "shabi");
        out.println(student);
        Map<String,Object> map = new HashMap<>();
        map.put("name","windy");
        map.put("age",18);
        map.put("sex","男");
        BeanUtils.populate(student,map);
        out.println(student);
    }
}
